<?php
namespace app\common\only\jy;

class OrderRefundProduct extends Base {
	protected $prefix = 'jy\\OrderRefundProduct';

	public function getRefundNum($opid) {
		$model = $this->getModel('jy\\OrderRefundProduct');
		return $this->get('get_refund_num_' . $opid, function($model, $opid) {
			$reapply = loadEnum('OrderRefundStatus')->reapply();
			return $model->alias('ORP')->join('OrderRefund OR', 'ORP.orid = OR.id')->where(['opid' => $opid])->whereNotIn('status', $reapply)->sum('ORP.num');
		}, [$model, $opid]);
	}
}
